@isTest

Private class WorkflowControllerTest {


    static testMethod void test_Workflow()

    {
        Workflow_definition__c wd1 = new Workflow_definition__c();
        PageReference pageRef = Page.WorkflowDefinition;
        Test.setCurrentPage(pageRef);
        ApexPages.StandardController ctrl = new ApexPages.StandardController(wd1);
        WorkflowController class1 = new WorkflowController(ctrl);
            
            Assignment_Group_Name__c AGN = new Assignment_Group_Name__c();
            AGN.name = 'AG1';
            AGN.Function__c = 'TestOrder';
            AGN.Type__c = 'Fulfillment';
            AGN.Description__c = 'Description';
            AGN.Round_Robin__c = true;
            insert AGN;
                        
            Workflow_Activities__c WAT = new Workflow_Activities__c();
            WAT.name = 'WA1';
            insert WAT;
            
                                   
            Stage_Definition__c fPD = new Stage_Definition__c();
            fPD.name = 'TestOrder';
            fPD.Stage_Description__c = 'Desc';
            fPD.Sequence__c = 88;
            fPD.Status__c = 'Active';
            insert fPD;
            
            Stage_Definition__c StD1 = new Stage_Definition__c();
            StD1.name = 'TestOrder2';
            StD1.Stage_Description__c = 'Desc';
            StD1.Sequence__c = 78;
            StD1.Status__c = 'Active';
            insert StD1;
          
                      
            Step_definition__c SDF = new Step_definition__c();
            SDF.name = 'SD1';
            SDF.Stage__c = fPD.id;
            SDF.Step_Sequence__c = 17;
            SDF.Target_Days__c = 4;
            SDF.Dashboard_Function__c = '';
            SDF.status__c='Active';
            insert SDF;
            
            //Assignment_Group_Name__c AG = new Assignment_Group_Name__c(name='SG1',Description__c='Desc',);
            
            Activities_Definition__c APD = new Activities_Definition__c();
            APD.name = 'Advertiser Approval';
            APD.Required__c = True;
            APD.Status__c = 'Active';
            APD.Step__c = SDF.id;
            insert APD;
            
        Test.StartTest(); 
        class1.saveWF();
        
        class1.Stages[0].selectbox = true;
        fPD.sequence__c = 1;
        class1.Stages[0].SD = fPD;

        class1.saveStages();
        
        class1.asgnGroups[0].slctbox=true;
         
        class1.saveGroup();
        
        class1.wrapOut[0].Step.selbox=true;
        class1.wrapOut[0].Step.defaultAG=AGN.id;        
        class1.wrapOut[0].Step.StepDef.step_sequence__C= 1;
        class1.wrapOut[0].Act[0].slctbox =true;

        class1.saveSteps();
        
        class1.saveWF();
        class1.saveStages();
        class1.saveGroup(); 
        class1.saveSteps();
                     
             
        Test.StopTest();               
    }

}